import {http} from '../utils/http';

/**
 * API 响应包装接口
 */
export interface ApiResponse<T = any> {
    code: number
    data: T
    msg?: string
}

/**
 * 用户信息接口
 */
export interface UserInfo {
    id: number
    nickname: string
    deptName: string
    professionalTitle?: string
    level?: number
}

/**
 * 获取用户基本信息
 */
export function getUserInfo() {
    return http.get('/app/user/get');
}

/**
 * 用户信息 API
 */
export const UserApi = {
    /**
     * 获取当前用户信息
     * @returns 用户信息
     */
    getCurrentUser: (): Promise<ApiResponse<UserInfo>> => {
        return http.get('/app/user/profile/get')
    },

    /**
     * 获取用户列表
     * @returns 用户列表
     */
    getSimpleUserList: (): Promise<ApiResponse<Array<{
        id: number
        nickname: string
        deptIds?: number[]
        deptNames?: string[]
    }>>> => {
        return http.get('/app/user/list-all-simple')
    },
}